package com.bestvike.stone.spring.feign;

import com.bestvike.stone.spring.feign.core.RestFeign;
import feign.Feign;
import feign.Retryer;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.cloud.openfeign.FeignContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;

/**
 * Created by 许崇雷 on 2018-02-09.
 */
@Configuration
@ConditionalOnClass(FeignContext.class)
public class FeignClientsConfiguration extends org.springframework.cloud.openfeign.FeignClientsConfiguration {
    @Bean
    @Scope("prototype")
    @ConditionalOnMissingBean
    @Override
    public Feign.Builder feignBuilder(Retryer retryer) {
        return RestFeign.builder();
    }
}
